function enterLog(event)
{
	if(event.keyCode==13)
	{
		doLogin();
	}
}



function doLogin()
{ 
	$.post('function/check-login.php',
		{
			'username' : $('#username').val(),
			'password' : $('#password').val()
		},function(data)
		{	
			if(data!="PASS")
			{
				
				window.location="admin.php";
			}
			else 
			{
				doLoginStudent();
			}
		});
}
function doLoginStudent()
{
	$.post('function/check-student.php',
		{
			'username' : $('#username').val(),
			'password' : $('#password').val()
		},function(data)
		{	
			if(data!="PASS")
				{
				window.location="student.php";
				}
				else 
			{
				doLoginTeacher();
			}
		});
}

function doLoginTeacher()
{	
	$.post('function/check-teacher.php',
		{
			'username' : $('#username').val(),
			'password' : $('#password').val()
		},function(data)
		{	
			if(data!="PASS")
				{
				window.location="teacher.php";
				}
				else 
			{
				
				alert("please insert correct e-mail and password");
				$('#username').val('');
				$('#password').val('');
			}
		});
}

	         <!--
       function isLoginKey(evt)
       {
          var charCode = (evt.which) ? evt.which : event.keyCode;
          if (charCode < 33 || charCode > 47
			&&(charCode < 58 || charCode > 64)
			&&(charCode < 91 || charCode > 96)
			&&(charCode < 123 || charCode > 126))
		   {
				return true;	
		   }
			else
		   {
				event.preventDefault();
				$('#dialoglog').html('CAN NOT USE SIGN');
				$('#dialoglog').dialog({'title':'Error!!!'});
				$('#dialoglog').dialog({ buttons: [ { text: "Ok", click: function() { $( this ).dialog( "close" ); } } ] });
		   }
          //return true;	  
       }
       //-->




	   /*function doLogin()
{
	$.post('function/checklogin.php',
		{
			'username' : $('#username').val(),
			'password' : $('#password').val()
		},function(data)
		{	
			if(data=="PASS")
				{
				alert("please insert correct e-mail and password");
				$('#username').val('');
				$('#password').val('');
				}
			else 
			{
				window.location="admin.php";
			}
		});
}*/